package LCR;

class TreeNode1 {
    int val;
    TreeNode left;
    TreeNode right;

    public TreeNode1() {
    }

    public TreeNode1(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
    public static void creat(String inp){


    }
}
public class kthToLast {
    public int kthToLast(ListNode head, int k) {
        ListNode fast = head;
        ListNode ret = head;
        while(k > 0) {
            fast = fast.next;
            k--;
        }
        while(fast != null) {
            head= head.next;
            fast = fast.next;
        }
        return head.val;
    }
}
